<!-- Dusan Milic -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<script type="text/javascript" src="jquery.js"></script>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="favicon.ico">
<title>Profil Korisnika</title>
<script type="text/javascript">

function oceniPlus(IdFir)
{
	 $("#podaci").load("oceniFirmu.php", { plus:"1", idKor:IdFir});
}
function oceniMinus(IdFir)
{
	 $("#podaci").load("oceniFirmu.php", { plus:"0", idKor:IdFir});
}


function popuni() {
	document.info.imeprezime.value=whatever;
	
	
	<?php 
			include("konekcija_sa_bazom.php");
		   $id=$_GET["id"];
           $query = "SELECT * FROM korisnik WHERE idKorisnik =$id";
		   $result = mysql_query($query);
		   $row = mysql_fetch_array($result);
		   ?>
		   var whatever = '<?php echo($row[3]); ?>';
		   document.info.imeprezime.value=whatever;
		   var whatever = '<?php echo($row[1]); ?>';
		   document.info.mail.value=whatever;
		   var whatever = '<?php echo($row[5]); ?>';
		   document.info.idSlike.value=whatever;
		
		   <?php 
           $query = "SELECT * FROM prodavnica WHERE idKorisnik =$id";
		   $result = mysql_query($query);
		   $row = mysql_fetch_array($result);
		   ?>
		   var whatever = '<?php echo($row[1]); ?>';
		   document.info.adresa.value=whatever;
		   var whatever = '<?php echo($row[2]); ?>';
		   document.info.grad.value=whatever;
		    var whatever = '<?php echo($row[3]); ?>';
		   document.info.broj.value=whatever;
		    var whatever = '<?php echo($row[4]); ?>';
		   document.info.sajt.value=whatever;
		    var whatever = '<?php echo($row[5]); ?>';
		   document.info.opis.value=whatever;
		   
		   
		   
		   
}
function izmeni()
{
	document.info.sacuvaj.style.visibility="visible";
	document.info.IZMENI.style.visibility="hidden";
	document.info.imeprezime.readOnly=false;
	document.info.mail.readOnly=false;
	document.info.adresa.readOnly=false;
	document.info.grad.readOnly=false;
	document.info.broj.readOnly=false;
	document.info.sajt.readOnly=false;
	document.info.opis.readOnly=false;
}

function save(){
	
	document.info.sacuvaj.style.visibility="hidden";
	document.info.IZMENI.style.visibility="visible";
	document.info.imeprezime.readOnly=true;
	document.info.mail.readOnly=true;
	document.info.adresa.readOnly=true;
	document.info.grad.readOnly=true;
	document.info.broj.readOnly=true;
	document.info.sajt.readOnly=true;
	document.info.opis.readOnly=true;
	
}

</script>

<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>

<body onload="popuni()">

<div id="wrapper">
   <?php
       session_start();
   include("insert/head.php"); ?>
	

    
    
    <div id="content">
    
   	  <form enctype="multipart/form-data" name="info" method="post" action="salji_bazi2.php">
    	<div id="content-main" style="/* [disabled]height:700px; */">
            <h1>PROFIL FIRME</h1>
         <table width="500" border="0" cellspacing="1" cellpadding="1" align="center" bgcolor="#FFCC99">
         <th colspan="3">Podaci</th>
   <tr > 
           <td width="20%">Ime :</td>
           <td><input name="imeprezime" type="text" size="30" readonly="readonly"></td>
           <td colspan="4">&nbsp;</td>
           </tr>
              <tr> 
           <td width="20%">Mail :</td>
           <td><input name="mail" type="text" size="30" readonly="readonly"></td>
           <td colspan="4">&nbsp;</td>
           </tr>
              
           <tr> 
           <td width="30%">Adresa :</td>
           <td><input name="adresa" type="text" size="30" readonly="readonly"></td>
           <td colspan="4">&nbsp;</td>
           </tr>
            <tr> 
           <td width="30%">grad :</td>
           <td><input name="grad" type="text" size="30" readonly="readonly"></td>
           <td colspan="4">&nbsp;</td>
           </tr>
            <tr> 
           <td width="30%">Broj Telefona :</td>
           <td><input name="broj" type="text" size="30" readonly="readonly"></td>
           <td colspan="4">&nbsp;</td>
           </tr>
           <tr> 
           <td width="30%">Sajt :</td>
           <td><input name="sajt" type="text" size="30" readonly="readonly"></td>
           <td colspan="4">&nbsp;</td>
           </tr>
           <tr> 
           <td width="30%">Opis delatnosti :</td>
           <td><input name="opis" type="text" size="30" readonly="readonly"></td>
           <td colspan="4">&nbsp;</td>
           </tr>



         </table>
         <input name="id" type="text" size="30" readonly="readonly" style="visibility:hidden;" value='<?php echo($_GET["id"]); ?>'>
         <input name="idSlike" type="text" size="30" readonly="readonly" style="visibility:hidden;" />
         <?php
		 $id=$_GET["id"];
		
		  $tekId=$_SESSION["id"];
		  if($id==$tekId)
		  echo' <br/><input class="button"  name="IZMENI"  type="button" value="Izmeni" onclick="izmeni()" />';
		  else echo' <br/><input class="button"  name="IZMENI" style="visibility:hidden;"  type="button" value="Izmeni" onclick="izmeni()" />';
		  
		 ?>
         
         
        	
         <input class="button"  name="sacuvaj" style="visibility:hidden;" type="submit"  id="23" value="Sacuvaj" />
          <br/>
          <h2>Pokloni </h2>
          
		  <?php include("konekcija_sa_bazom.php");
		  
           $query = "SELECT * FROM poklon WHERE idKorisnik =$id";
		   $result = mysql_query($query);
		   $numResults = mysql_num_rows($result);
		   echo '<div class="dashes"></div>';
		   
	
	$iter = 10;
	while (($row = mysql_fetch_array($result)) && $iter < 20) {
		echo '<a class="scroll-elem-box" href="ProfilPoklona.php?id='.$id.'">';
		
		echo '<img src="phpscripts/prikazisliku.php?id='. $row["idSlika"]. '" style="max-height: 130px; max-width: 130px" />';
		echo '<br/>';
		if (isset($row["naziv"])) echo $row["naziv"];
		else echo $row["ime"];
		echo '</a>';
		
		$iter--;
	}
		   ?>
          
         
        
        
        
        	     	
        </div> 
                <ul id="content-side">
        <li style="height:200px">
        	<div class="dashes-top"></div>
            <div class="dashes-bottom"></div>
        	<h2> Slike </h2>
        	<blockquote>
        	  <p><br/>
        	    
        	    <img src="phpscripts/prikazisliku.php?id=<?php echo($_GET["id"]); ?>" style="max-height: 130px; max-width: 130px" />
      	    </p>
               <br/><br/>    
      	  </blockquote>
        	<input type="hidden" name="MAX_FILE_SIZE" value="64000" />
                                <label for="file">Одабери слику:</label>
                                <input id="userfile" type="file" name="userfile" />
                                <input name="upload" type="submit" class="box" id="upload" value=" Ubaci ">
                           
                             
                             
                                    
                                <br/><br/>    
                                <h1>Ocena prodavnice</h1>
              <?php
		   $query = "SELECT brojPluseva,brojMinusa FROM prodavnica WHERE idKorisnik =$id";
		   $result = mysql_query($query);
		   $row = mysql_fetch_array($result);
		   $plus=$row[0];
		   $minus=$row[1];
	    echo '<ul id="content-side">
       			 <li id="podaci" style="height:100px">
        			<div class="dashes-top"></div>
           			 <div class="dashes-bottom"></div>
           			 <font size="+1">';			
			
					echo '<center><img src="images/plus.png" onClick="javascript:oceniPlus('.$id.')" alt="Plus" />'.$plus.':'.$minus.'		<img 					src="images/minus.png" onClick="oceniMinus('.$id.')"alt="Minus" /></center>';	        
		   
		   
		   
		  
            echo"</li>
            </ul>";
             ?>
          </li>
           
           
 
        </form>
              
        
    
</div>


</body>
</html> 